const ACCESSTOKEN = 'accessToken'
const REFRESHTOKEN = 'refreshToken'


// 获得token
export const getToken = () => {
    let token = localStorage.getItem(ACCESSTOKEN)
    return token
}

// 获取refreshToken
export const getRefresToken = () => {
    let refreshToken = localStorage.getItem(REFRESHTOKEN)
    return refreshToken
}

// 保存Token
export const setToken = (accountToken, RefreshToken) => {
    if (accountToken && RefreshToken) {
        localStorage.setItem(ACCESSTOKEN, accountToken)
        localStorage.setItem(REFRESHTOKEN, RefreshToken)
    }
}

// 根据当前token是否存在,判断是否可以登录
export const isLogin = () => {
    let token = getToken()
    if (token) {
        return true
    } else {
        return false
    }
}